using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using org.in2bits.MyXls;

namespace OpenSource.SpreadsheetFactory.Internal.Xls
{
    internal sealed class ExcelRowCollection : IEnumerable<Row>, IEnumerable
    {
        private Rows rows { get; set; }

        public ExcelRowCollection(Rows rows)
        {
            this.rows = rows;
        }

        public ExcelRowCollection(Worksheet worksheet)
            : this(worksheet.Rows)
        {
        }

        #region IEnumerable<Row> Members

        public IEnumerator<Row> GetEnumerator()
        {
            for (uint i = rows.MinRow; i <= rows.MaxRow; i++)
            {
                yield return rows[(ushort)i];
            }
        }

        #endregion

        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}

